home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / CRACK3212.ASM < prev    next >
Encoding:
Assembly Source File  |  1999-01-28  |  3.2 KB  |  240 lines

  1. ;
  2. ;    16-bit keyfile finder. Use a bit faster 32-bit version instead it.
  3. ;
  4.     .model tiny
  5.     .486
  6.     .code
  7.     .startup
  8.     org 100h
  9.  
  10.     mov ax,3
  11.     int 10h
  12.     
  13.     push 0B800h
  14.     pop gs
  15.     call InitMagic32
  16.  
  17.     jmp @0
  18.     
  19.  
  20. Key    db 13,10,"---=== Keyfile generated by Ak Kort [SOS group] ===---"
  21.     db 13,10," http://www.sos.nanko.ru   e-mail: sos@russiamail.com "
  22.     db 13,10,13,10    
  23.     db 13,10,13,10    
  24.     db 256-($-offset Key) dup(1)
  25.  
  26. Magicon        equ 0edb88320h
  27. Magic32        dword 256 dup(1)
  28. _crc32        dd 0
  29. msg1        byte '   Precalculating 65536 masks...',13,10,36
  30. msg2        byte '   Cracking...',13,10,36
  31.  
  32. @0:
  33.     lea dx,msg1
  34.     mov ah,9
  35.     int 21h
  36.     
  37.     xor ecx,ecx
  38.     mov ax,cs
  39.     add ax,4096
  40.     mov es,ax
  41.     mov di,0
  42.  
  43. ;
  44. ;    Precalculating table
  45. ;
  46.         
  47.     @st equ 12345678h
  48. @f10:
  49.     push ecx
  50.     lea si,Key
  51.     mov eax,ecx
  52.     shl eax,16
  53.     mov ebx,@st
  54.     mov bp,0
  55.     mov cx,0FDh-8
  56. @f11:
  57.     push cx
  58.         movsx cx,byte ptr [si]
  59.         mov ax,[si+1]
  60.         inc si
  61.         mul cx
  62.         mov cl,[si+2]
  63.         @@1:
  64.         rol eax,cl
  65.         xor ebx,eax
  66.         push cx
  67.         movzx cx,al
  68.         rol ebx,cl
  69.         add bp,cx
  70.         pop cx
  71.         not eax
  72.         loop @@1    
  73.     pop cx
  74.     loop @f11
  75.     mov _eax,eax
  76.         
  77.     mov cx,bp
  78.     and cx,31
  79.     ror ebx,cl
  80.     xor ebx,@st
  81.     mov es:[di],cl
  82.     mov es:[di+1],ebx
  83.     add di,5
  84.     mov ax,di
  85.     mov cx,es
  86.     shr ax,4
  87.     add ax,cx
  88.     mov es,ax
  89.     and di,15
  90.     pop ecx
  91.     inc cl
  92.     jnz @f10
  93.     inc ch
  94.     mov gs:[0],ch
  95.     jnz @f10
  96.     push cs
  97.     pop es
  98.     
  99.     lea dx,msg2
  100.     mov ah,9
  101.     int 21h
  102.         
  103. ;
  104. ;    Precalculating crc32
  105. ;
  106.  
  107.     xor eax,eax
  108.     xor edx,edx
  109.     lea si,Key
  110.  
  111.     mov cx, 256-8
  112. @f3:    mov al,[si]
  113.     inc si
  114.     xor al,dl
  115.     shr edx,8
  116.     xor edx,Magic32[eax*4]
  117.     loop @f3
  118.     
  119.     mov Crc32,edx
  120.     
  121.     
  122. ;
  123. ;    main loop
  124. ;
  125.  
  126.     mov ecx,0
  127.     
  128. @e2:    push ecx    
  129.  
  130. Crc32    equ dword ptr $+2
  131.     mov edx,12345678h
  132.     xor eax,eax
  133.     lea si,Key+256-8
  134.  
  135. REPT 8
  136.     mov al,cl
  137.         shr ecx,4
  138.     and al,15
  139.         mov bl,dl
  140.     inc ax
  141.         shr edx,8
  142.     mov [si],al
  143.         xor al,bl
  144.     inc si
  145.         xor edx,Magic32[eax*4]
  146. ENDM
  147.  
  148.     mov eax,edx
  149.         mov ebx,edx
  150.  
  151.     shr eax,16
  152.         mov _crc32,edx    
  153.  
  154.     lea eax,[eax*4+eax+10000h]
  155.         mov cx,cs
  156.     mov di,ax
  157.         shr eax,4
  158.     and di,15
  159.         add ax,cx
  160.     mov ds,ax
  161.     
  162.     mov cl,ds:[di]
  163.         push cs
  164.     xor ebx,ds:[di+1]
  165.         lea si, Key+0FDh-8
  166.     rol ebx,cl
  167.         pop ds
  168.         
  169. _eax equ dword ptr $+2
  170.     mov eax,5555FDFDh
  171.  
  172.     xor cx,cx
  173.     REPT 8
  174.         local @@1
  175.         mov   cl,byte ptr [si]
  176.         mov     ax,[si+1]
  177.         mul cx
  178.         inc    si
  179.         mov cl,[si+2]    
  180.         @@1:
  181.         rol    eax, cl
  182.         xor    ebx, eax
  183.         xchg cx,ax
  184.         rol    ebx, cl
  185.         xchg cx,ax
  186.         not    eax
  187.         loop @@1
  188.     ENDM
  189.  
  190.     cmp    ebx, 0A69EC24Eh
  191.     jz    @ok
  192.     
  193.     pop ecx
  194.     inc cx
  195.     jnz @e2
  196.     mov eax,ecx
  197.     shr eax,16
  198.     mov byte ptr gs:[160],ah
  199.     mov byte ptr gs:[162],al
  200.     add ecx,10000h
  201.     jnz @e2
  202.         
  203.     retn
  204.     
  205. @ok:
  206.     pop ecx
  207.     lea dx,fname
  208.     mov ax,3C00h
  209.     xor cx,cx
  210.     int 21h
  211.     xchg ax,bx
  212.     lea dx,Key
  213.     mov cx,256
  214.     mov ah,40h
  215.     int 21h
  216.     mov ah,3Eh
  217.     int 21h
  218.     retn
  219.  
  220. fname    db '!ok!',0
  221.  
  222. InitMagic32:
  223.                 std
  224.                 mov     di,OFFSET Magic32+0400h-4    ; Last WORD of the array
  225.                 mov     dx,0FFh
  226. im0:            mov     cx,8
  227.                 movzx    eax,dx
  228. im1:            shr     eax,1
  229.                 jnc     im2
  230.                 xor     eax,Magicon
  231. im2:            loop    im1
  232.                 stosd
  233.                 dec     dx
  234.                 jns     im0
  235.                 cld
  236.                 ret
  237.  
  238. end
  239.  
  240.